/**
 * Created by Administrator on 2017-01-06.
 */


const  cgtArr = ['6901028250641',
    '6901028071505',
    '6901028126014',
    '6901028315104',
    '6901028149242',
    '6901028207881',
    '6901028020534',
    '6901028071291',
    '6901028191142',
    '6901028036962',
    '6901028208819',
    '6901028225779',
    '6901028138369',
    '6901028117555',
    '6901028080446',
    '4004018203756',
    '6901028055345',
    '6901028071772',
    '6901028136389',
    '6901028001687',
    '6901028225656',
    '6901028157650',
    '6901028065566',
    '6901028037884',
    '6901028025645',
    '6901028141147',
    '6901028137270',
    '6901028314985',
    '6901028316316',
    '6901028102308',
    '6901028133487',
    '6901028075084',
    '6901028315012',
    '6901028001885',
    '6901028075145',
    '6901028225595',
    '6901028191425',
    '6901028223621',
    '6901028025829',
    '6901028024976',
    '6901028071475',
    '6901028311465',
    '6901028000833',
    '8801116200597',
    '6901028047784',
    '6901028156783',
    '6901028315432',
    '6901028100670',
    '6901028142571',
    '6901028191111',
    '6901028169257',
    '4891132016610',
    '6901028157216',
    '6901028936477',
    '4891132016221',
    '6901028136327',
    '6901028037938',
    '6901028069793',
    '6901028079792',
    '4891888328623',
    '4891888328586',
    '6901028000659',
    '6901028003056',
    '6901028300063',
    '6901028936590',
    '6901028092951',
    '6901028117975',
    '6901028196321',
    '6901028163651',
    '6901028159579',
    '6901028102971',
    '6901028147262',
    '6901028138161',
    '6901028300087',
    '6901028137492',
    '4902210232607',
    '6901028072618',
    '6901028195645',
    '4902210249704',
    '4902210249902',
    '8888075005494',
    '8888075005524',
    '6901028033619',
    '6901028188449',
    '6901028073745',
    '6901028120494',
    '6901028078252',
    '6901028142168',
    '8888075005081',
    '8888075005142',
    '6901028207089',
    '6901028072793',
    '6901028180665',
    '8801116003303',
    '6901028186582',
    '6901028065504',
    '6901028119726',
    '6901028180580',
    '4030600001295',
    '6901028208352',
    '6901028150378',
    '6901028142137',
    '6901028065672',
    '6901028070072',
    '6901028001816',
    '4711588115289',
    '6901028070850',
    '6901028062015',
    '6901028163538',
    '6901028069885',
    '6901028221047',
    '8888075008068',
    '6901028317269',
    '6901028179867',
    '6901028071680',
    '6901028118828',
    '6901028316866',
    '6901028317177',
    '6901028100731',
    '6901028070164',
    '6901028170789',
    '6901028193504',
    '6901028179348',
    '6901028062329',
    '8888075005432',
    '6901028065252',
    '6901028124010',
    '6901028069762',
    '6901028047579',
    '6901028131605',
    '6901028142793',
    '6901028317160',
    '6901028196932',
    '6901028193863',
    '6901028062398',
    '6901028180504',
    '6901028120708',
    '9588813521796',
    '6901028316620',
    '6901028075039',
    '6901028030205',
    '6901028080668',
    '6901028114455',
    '9588813521680',
    '6901028160889',
    '6901028104579',
    '6901028193924',
    '6901028102940',
    '6901028048682',
    '6901028079679',
    '6901028172882',
    '6901028075022',
    '6901028223324',
    '6901028075015',
    '6901028169967',
    '6901028100113',
    '6901028134613',
    '6901028024136',
    '6901028001595',
    '6901028157629',
    '6901028207829',
    '6901028100960',
    '6901028317672',
    '6901028033640',
    '6901028250573',
    '6901028223805',
    '6901028013970',
    '6901028120791',
    '6901028142625',
    '6901028102667',
    '6901028024051',
    '6901028116190',
    '6901028004862',
    '6901028308205',
    '6901028076265',
    '6901028062688',
    '6901028086981',
    '6901028116619',
    '6901028074148',
    '6901028311793',
    '6901028179065',
    '6901028316019',
    '6901028112789',
    // '6901028223966',
    '6901028182539' ];





const pubgoodsinfo = `INSERT INTO MRTDB01.PUB_GOODSINFO
(ORG_CODE, TENANT_ID, SHOP_ID, GODS_ID, GODS_NAME, SHORT_GODS_NAME, GODS_SPELL, SORT_ID, BARCODE, BIG_BARCODE, UNIT_ID, BIG_UNIT_ID, INPRICE, BIG_INPRICE, OUTPRICE, BIG_OUTPRICE, OTHERTO_UNITS, SHELF_LIFE, IS_TOBACCO, IS_KEEP_PRICE, REMARK, STATUS, CREA_DATE, SOURCE_TYPE, LAST_SALETIME, COMM, TIME_STAMP, SECOND_ID, COM_TYPE, IS_RECOMMEND, DESCRIPTION, IS_ONLINE, IMG_PATH, AWARD_GETWAY, AWARD_MANTYPE, ONLINE_PRICE, ITEM_WEIGHT, ITEM_SIZE, SALE_STATUS)
VALUES('11610201', '220100010', '610222100303', 'godsId', '测试卷烟', '测试卷烟', 'CYXYH', '0EE56B', 'barcode', NULL, '000001', NULL, 1.500000, NULL, 3.000000, NULL, NULL, NULL, '02', '00', NULL, '01', '20160311', '02', NULL, '10', 1466404469, 'barcode', NULL, '00', NULL, NULL, NULL, NULL, '0000', NULL, 0.000, NULL, NULL);`


const stostrage = `INSERT INTO MRTDB01.STO_STORAGE
(ROWS_ID, ORG_CODE, TENANT_ID, SHOP_ID, GODS_ID, AMONEY, AMOUNT, UPPER_AMOUNT, LOWER_AMOUNT, SAFETY_AMOUNT, REASONABLE_AMOUNT, COST_PRICE, COMM, TIME_STAMP, SALE_STATUS)
VALUES('rowsId', '11610201', '220100010', '610222100303', 'godsId', 36.000000, storage.000000, 20.000000, 10.000000, 0.000000, 0.000000, 18.000000, '10', 1466404972, NULL);`

function generaterSql() {
    for(i in cgtArr){
    var godsId = random32();
    var rowsId = random32();
    var newsql = pubgoodsinfo.replace('godsId',godsId);
    newsql = newsql.replace('barcode',cgtArr[i]);

    console.log(newsql);

    var storage = parseInt(Math.random()*50,10);
    newsql = stostrage.replace('godsId',godsId);
    newsql = newsql.replace('rowsId',rowsId);
    newsql = newsql.replace('storage',storage);

    console.log(newsql);

    }

}
generaterSql()

function random32() {

    const letter = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    let value='';
    for(var i = 0; i < 32; i++){
        value += letter[parseInt(Math.random()*36,10)]
    }
    return value;
}